﻿<sdk:ChildWindow
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:vm="clr-namespace:SGTLightAccent.ViewModel"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"           
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="SGTLightAccent.Views.NuevaCargaWindow"
           Width="725" Height="463" 
           Title="Nuevo ingreso de barco"           
                      >

    <sdk:ChildWindow.Resources>
        <vm:MainVMHelper x:Name="MainVM"/>
    </sdk:ChildWindow.Resources>
	<sdk:ChildWindow.DataContext>
		<Binding Path="Main" Source="{StaticResource Locator}"/>
	</sdk:ChildWindow.DataContext>
    <Grid x:Name="LayoutRoot" Margin="2">

        <Grid.RowDefinitions>
            <RowDefinition Height="230*" />
            <RowDefinition Height="59" />
        </Grid.RowDefinitions>
        <Button x:Name="CancelButton" Content="Guardar" Click="CancelButton_Click" Width="75" Height="30" HorizontalAlignment="Right" Margin="0,17,12,12" Grid.Row="1" Command="{Binding BotonGuardarCarga}" />
        <Button x:Name="OKButton" Content="Cancelar" Click="OKButton_Click" Width="75" Height="30" HorizontalAlignment="Left" Margin="522,17,0,12" Grid.Row="1" />
        <sdk:Label Content="Barco" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="12,99,0,0" x:Name="label1" VerticalAlignment="Top" Width="56" />
        <ComboBox DisplayMemberPath="Nombre" Height="28" HorizontalAlignment="Left" ItemsSource="{Binding Barcos}" Margin="113,99,0,0" x:Name="comboBox1" SelectedItem="{Binding CargaNueva.Barco, Mode=TwoWay}" VerticalAlignment="Top" Width="191" />
        <sdk:Label Content="Fecha entrada" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="12,12,0,0" x:Name="label3" VerticalAlignment="Top" Width="104" />
        <sdk:DatePicker Height="28" HorizontalAlignment="Left" Margin="113,12,0,0" x:Name="datePicker1" SelectedDate="{Binding CargaNueva.Fecha_Ingreso, Mode=TwoWay}" VerticalAlignment="Top" Width="191" />
        <sdk:Label Content="Fecha salida" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="12,51,0,0" x:Name="label4" VerticalAlignment="Top" Width="104" />
        <sdk:DatePicker Height="28" HorizontalAlignment="Right" Margin="0,51,399,0" x:Name="datePicker2" SelectedDate="{Binding CargaNueva.Fecha_Salida, Mode=TwoWay}" VerticalAlignment="Top" Width="191" />
        <sdk:TabControl Height="353" HorizontalAlignment="Left" Margin="339,12,0,0" x:Name="tabControl1" VerticalAlignment="Top" Width="352">
            <sdk:TabItem Header="Bodegas" x:Name="tabItem1">
                <Grid Height="320">
                    <sdk:DataGrid AutoGenerateColumns="False" ItemsSource="{Binding CargaNueva.Bodega}" x:Name="dgBodegas" CellEditEnded="dgBodegas_CellEditEnded">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTextColumn Binding="{Binding Numero}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Número" Width="Auto" />
                            <sdk:DataGridTemplateColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Producto" Width="150*">
                                <sdk:DataGridTemplateColumn.CellEditingTemplate>
                                    <DataTemplate>
                                        <ComboBox DisplayMemberPath="Nombre" ItemsSource="{Binding Main.Productos, Source={StaticResource MainVM}}" x:Name="CmbProducto" SelectedItem="{Binding Mercaderia, Mode=TwoWay}" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellEditingTemplate>
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Mercaderia.Nombre}" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTextColumn Binding="{Binding Toneladas}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Toneladas" Width="Auto" />
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                </Grid>
            </sdk:TabItem>
        </sdk:TabControl>
        <sdk:Label Content="N° Bodegas" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="12,0,0,184" x:Name="label2" VerticalAlignment="Bottom" Width="79" />
        <TextBox Height="28" HorizontalAlignment="Left" IsReadOnly="True" Margin="113,151,0,0" x:Name="textBox3" Text="{Binding CantBodegas, Mode=TwoWay}" VerticalAlignment="Top" Width="57" />
        <Button Command="{Binding BotonIncrementarBodegas}" Content="+" Height="28" HorizontalAlignment="Left" Margin="176,151,0,0" x:Name="button1" VerticalAlignment="Top" Width="26" />
        <sdk:Label Content="Carga neta" Height="28" HorizontalContentAlignment="Right" x:Name="label5" Width="78" Margin="12,264,0,73" HorizontalAlignment="Left" />
        <TextBox Height="28" x:Name="textBox1" Text="{Binding CargaNueva.Peso, Mode=TwoWay}" Width="191" Margin="0,264,399,73" HorizontalAlignment="Right" />
        <sdk:Label Content="Cliente" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="12,0,0,134" x:Name="label2_Copy" VerticalAlignment="Bottom" Width="79" d:LayoutOverrides="VerticalAlignment" />
        <ComboBox DisplayMemberPath="Nombre" Height="28" HorizontalAlignment="Left" ItemsSource="{Binding Clientes}" Margin="113,0,0,134" x:Name="comboBox1_Copy" SelectedItem="{Binding CargaNueva.Proveedor, Mode=TwoWay}" VerticalAlignment="Bottom" Width="191" />
    </Grid>
</sdk:ChildWindow>